package test;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import ygflower.dao.UserDao;
import ygflower.domain.User;

/**
 * Created by IntelliJ IDEA.
 * User: lee
 * Date: 2010-1-27
 * Time: 21:28:02
 * To change this template use File | Settings | File Templates.
 */
public class PersistByJPA_Spring {
    public static void main(String[] args){
//        ApplicationContext ac = new ClassPathXmlApplicationContext("services.xml");
        ApplicationContext ac2 = new ClassPathXmlApplicationContext("services.xml");
//        FlowerDao jfd = (FlowerDao) ac.getBean("jpaUserDao");
//        Flower flower = new Flower("jpa_spring",20,12,"picture","tis is a flower");
        User u = new User("lee","dermot");   
//        jfd.create(flower);
//        jfd.create(u);
        UserDao jfd2 = (UserDao) ac2.getBean("jpaUserDao");
        Object o = ac2.getBean("/user.htm");
        jfd2.save(u);
//        jfd.update();
//        PersonDao personDao = (PersonDao)ac2.getBean("personDao");
//		Person person = new Person();
//		Address address = new Address();
//		
//		person.setFirstName("成都");
//		person.setLastName("星源");
//		address.setStreetNumber(100);
//		address.setStreetName("创业街道");
//		
//		person.setAddress(address);
//		personDao.save(person);
    }
}
